﻿namespace Common
{
    public class ClassVehicle
    {
        public ClassVehicle() { }
        /// <summary>
        /// 车号
        /// </summary>
        public string Number { get; set; }
        /// <summary>
        /// 品牌
        /// </summary>
        public string Brand { get; set; }
        /// <summary>
        /// 型号
        /// </summary>
        public string Type { get; set; }
        /// <summary>
        /// 项目：project 车检
        /// </summary>
        public bool Procj { set; get; }
        /// <summary>
        /// 项目：车速
        /// </summary>
        public bool Procs { set; get; }
        /// <summary>
        /// 项目：痕迹
        /// </summary>
        public bool Prohj { set; get; }
        /// <summary>
        /// 项目：损失
        /// </summary>
        public bool Pross { set; get; }
        /// <summary>
        /// 项目：成因
        /// </summary>
        public bool Procy { set; get; }
        /// <summary>
        /// 项目：过程
        /// </summary>
        public bool Progc { set; get; }
        /// <summary>
        /// 项目：属性
        /// </summary>
        public bool Prosx { set; get; }
		/// <summary>
		/// 项目：驾驶员判定
		/// </summary>
		public bool Projsy { set; get; }
		/// <summary>
		/// 项目：方向判断
		/// </summary>
		public bool Profx { set; get; }

        public string Coding2String(char split)
        {
            if(Number == string.Empty & Brand == string.Empty & Type == string.Empty)
            {
                return string.Empty;
            }
            string b = null;
            b += Number + split;
            b += Brand + split;
            b += Type + split;
            string temp = "";
            if (Procj) { temp += "a"; };
            if (Procs) { temp += "b"; };
            if (Prohj) { temp += "c"; };
            if (Pross) { temp += "d"; };
            if (Procy) { temp += "e"; };
            if (Progc) { temp += "f"; };
            if (Prosx) { temp += "g"; };
			if (Projsy) { temp += "h"; };
			if (Profx) { temp += "i"; };
			//if (temp == null || temp == "") { temp = "x"; };
            b += temp;
            return b;
        }

        public void DecodingFromString(string message, char split)
        {
            string[] str = message.Split(split);
            Number = str[0];
            Brand = str[1];
            Type = str[2];
            string temp = str[3];
            //if (temp.IndexOf("x") >= 0) { return; };
            if (temp.IndexOf("a") >= 0) { Procj = true; };
            if (temp.IndexOf("b") >= 0) { Procs = true; };
            if (temp.IndexOf("c") >= 0) { Prohj = true; };
            if (temp.IndexOf("d") >= 0) { Pross = true; };
            if (temp.IndexOf("e") >= 0) { Procy = true; };
            if (temp.IndexOf("f") >= 0) { Progc = true; };
            if (temp.IndexOf("g") >= 0) { Prosx = true; };
			if (temp.IndexOf("h") >= 0) { Projsy = true; };
			if (temp.IndexOf("i") >= 0) { Profx = true; };
		}

        public void Clone(ClassVehicle vehicle)
        {
            Number = vehicle.Number;
            Brand = vehicle.Brand;
            Type = vehicle.Type;
            Procj = vehicle.Procj;
            Procs = vehicle.Procs;
            Prohj = vehicle.Prohj;
            Pross = vehicle.Pross;
            Procy = vehicle.Procy;
            Progc = vehicle.Progc;
            Prosx = vehicle.Prosx;
			Projsy = vehicle.Projsy;
			Profx = vehicle.Profx;
		}
    }
}
